/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package cn.ac.iie.di.wx.statweb.utils;

import com.alibaba.fastjson.JSON;
import java.util.List;

/**
 *
 * @author Administrator
 */
public class ToJsonUtil {

    public static String toJSONString(List list, List pagelist, String start, String limit) {
        int sl = Integer.parseInt(start) + Integer.parseInt(limit);
        for (int p = Integer.parseInt(start); p < (sl < list.size() ? sl : list.size()); p++) {
            pagelist.add(list.get(p));
        }
        Object toJSON = JSON.toJSON(pagelist);
        String toJSONstr = " {\"totalProperty\":\"" + list.size() + "\",\"root\":" + toJSON.toString() + "}";
        return toJSONstr;
    }
}
